export default date => {
    let tt = new Date(parseInt(date))
    let days = parseInt((new Date().getTime() - date) / 86400000)
    let today = new Date().getDate()
    let year = tt.getFullYear()
    let mouth = tt.getMonth() + 1
    let day = tt.getDate()
    let time = tt.getHours() < 10 ? "0" + tt.getHours() : tt.getHours()
    let min = tt.getMinutes() < 10 ? "0" + tt.getMinutes() : tt.getMinutes()
    let result, offset
    offset = Math.abs(today - day)
    if (days < 4 && offset < 4) {
        if (offset === 0) {
            result = "今天" + time + ":" + min
        } else if (offset === 1) {
            result = "昨天" + time + ":" + min
        } else if (offset === 2) {
            result = "前天" + time + ":" + min
        }
    } else {
        result = year + "-" + mouth + "-" + day + " " + time + ":" + min
    }
    $time.innerHTML = result
}
